package com.client.controller;

import com.alibaba.fastjson2.JSON;
import com.client.mcp.ChatService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author WuFengSheng
 * @date 2025/4/19 10:16
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("mcpClient")
public class McpClientController {

    private final ChatService chatService;

    @GetMapping("listTools")
    public Object listTools() {
        return JSON.toJSON(chatService.getToolCallbacks());
    }

    @GetMapping("chat")
    public String chat(String prompt) {
        log.info("prompt={}", prompt);
        return chatService.askQuestion(prompt);
    }

}
